//bool, ObjList objs, str OUT reasonText

int min_resource_gold;
str name;

min_resource_gold = GetConst("MinResQtyToTransportGold"); 
name = cmdparam;
if(name == 5000){
	min_resource_gold = 5000;
}
if(objs.count)
{
	Building bld;
	bld = objs[0].AsBuilding();        

	if(bld.IsValid())
	{
		Settlement this;
		this = bld.settlement;

		if(.IsValid())
		{

			if (.IsVillage()) // when anuy village house is damages
			{
				ObjList olBuildings;
				Building b;
				int i;
				olBuildings = .Buildings();                                

				for (i=0; i<olBuildings.count;i+=1)
				{
					b = olBuildings[i];
					if (!b.IsValid()) continue;
					if ((b.IsBroken() || b.IsVeryBroken()) && .population<GetConst("MinPopulation"))
					return false;	
				}
			}
			
			if(.gold < min_resource_gold)
			{
				reasonText = rollover(bld, true) + "\n<color 255 0 0>";
				reasonText = reasonText + Translatef("Requires %s1 gold", min_resource_gold);
				return false;
			}
		}
	}
}
return true;